<template>
 <footer class="footer">
    <router-link v-for="(v, i) in list" :key="i" @click.native="switchFoot(v)" tag="figure" :to="v.path">
      <p :class="v.as">
      <figcaption>{{v.name}}</figcaption>
    </router-link>
  </footer>
</template>
<script>
    export default {
  data () {
    return {
      list: [
        {
          as: 'iconfont icon-eliaomo',
          name: '外卖',
          path: '/'
        },
        {
          as: 'iconfont icon-icon-yxj-empty-discover',
          name: '发现',
          path: '/kty'
        },
        {
          as: 'iconfont icon-dingdan',
          name: '订单',
          path: '/dingdan'
        },
        {
          as: 'iconfont icon-home',
          name: '我的',
          path: '/wode'
        }
      ]
    }
  },
  methods: {
    switchFoot (v) {
      this.$emit('navTitle', v.name)
    }
  },
  created () {
    this.$emit('navTitle', this.list[0].name)
  }
}
</script>
<style scoped lang="less">
.px2rem(@name, @px) {
    @{name}: @px / 75 * 1rem;
}
.footer{
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    .px2rem(height,120);
    display: flex;
    background: white;
    figure{
      &.router-link-exact-active{
        background-color: #fff;
      }
      flex: 1;
      margin: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      p{
       .px2rem(font-size,44);
      }
      figcaption{
       .px2rem(font-size,30);
      .px2rem(margin-top,10);
        box-sizing: border-box;
      }
    }
    figure:first-child{
           color: #3366FF;
       }
  }
</style>
